/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "medios")
@NamedQueries({@NamedQuery(name = "Medios.findAll", query = "SELECT m FROM Medios m"), @NamedQuery(name = "Medios.findByMeMedio", query = "SELECT m FROM Medios m WHERE m.meMedio = :meMedio"), @NamedQuery(name = "Medios.findByMeDescripcion", query = "SELECT m FROM Medios m WHERE m.meDescripcion = :meDescripcion")})
public class Medios implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="medioGen")
    @SequenceGenerator(name="medioGen", sequenceName="medios_me_medio_seq")
    @Basic(optional = false)
    @Column(name = "me_medio")
    private Integer meMedio;
    @Column(name = "me_descripcion")
    private String meDescripcion;
    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "deMedio", fetch = FetchType.LAZY)
    private Set<Denuncias> denunciasSet;

    public Medios() {
    }

    public Medios(Integer meMedio) {
        this.meMedio = meMedio;
    }

    public Integer getMeMedio() {
        return meMedio;
    }

    public void setMeMedio(Integer meMedio) {
        this.meMedio = meMedio;
    }

    public String getMeDescripcion() {
        return meDescripcion;
    }

    public void setMeDescripcion(String meDescripcion) {
        this.meDescripcion = meDescripcion;
    }

    public Set<Denuncias> getDenunciasSet() {
        return denunciasSet;
    }

    public void setDenunciasSet(Set<Denuncias> denunciasSet) {
        this.denunciasSet = denunciasSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (meMedio != null ? meMedio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Medios)) {
            return false;
        }
        Medios other = (Medios) object;
        if ((this.meMedio == null && other.meMedio != null) || (this.meMedio != null && !this.meMedio.equals(other.meMedio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.domain.Medios[meMedio=" + meMedio + "]";
    }

}
